#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	int arr[1000] = { 0 };
	int i = 0;
	do
	{
		scanf("%d", &arr[i]);
		i++;
		getchar();
	} while (arr[i-1] != 0);
	int n = i - 2;
	for (1; n >= 0; n--)
	{
		printf("%d ", arr[n]);
	}
	return 0;
}